<?php
namespace Events\Form;

use Zend\InputFilter\InputFilter;

class EventFormFilter extends InputFilter
{

    public function __construct()
    {
               
        $this->add(array(
            'name' => 'TITLE',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY => 'Empty'
                        )
                    )
                )
                
            )
        ));
        
        $this->add(array(
            'name' => 'DATE',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY => 'Empty'
                        )
                    )
                )
        
            )
        ));
        
/*         $this->add(array(
            'name' => 'SESSIONS',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY => 'Empty'
                        )
                    )
                )
        
            )
        )); */
        
        $this->add(array(
            'name' => 'SUBJECT',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY => 'Empty'
                        )
                    )
                )
        
            )
        ));
        
        
        $this->add(array(
            'name' => 'DESCRIPTION',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY => 'Empty'
                        )
                    )
                )
        
            )
        ));
        
        $this->add(array(
            'name' => 'PLACE',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY => 'Empty'
                        )
                    )
                )
        
            )
        ));
        
        
        $this->add(array(
            'name' => 'CATEGORY',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name'    => 'InArray',
                        'options' => array(
                            'haystack' => array(1,2,3,4),
                            'messages' => array(
                                'notInArray' => 'Please select a caategory !' 
                            ),
                        ),
                )
        
            )
        ));
        
        $this->add(array(
            'name' => 'EVENT_STATUS',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name'    => 'InArray',
                    'options' => array(
                        'haystack' => array(1,2),
                        'messages' => array(
                            'notInArray' => 'Please select a Status !'
                        ),
                    ),
                )
        
            )
        ));
        
        $this->add(array(
            'name' => 'SEATS',
            'filters' => array(
                array('name' => 'StringTrim'),
            ),
            'validators' => array(
                array(
                    'name' => 'NotEmpty',
                    'options' => array(
                        'messages' => array(
                            \Zend\Validator\NotEmpty::IS_EMPTY => 'Empty'
                        )
                    )
                ),
                array(
                     'name' => 'Between',
                     'options' => array(
                           'min' => 1,
                           'max' => 1000,
                         'messages' => array(
                             \Zend\Validator\Between::NOT_BETWEEN => 'maximum number of seats allowed is 1000'
                         )
                     ),
                ),
            )
        ));
        
    }
}